package javaLearning.接口与继承;

/**
 * @author : K k
 * @date : 13:22 2020/8/14
 * 静态变量 与类的关系
 * 静态变量所有类共享 方法区中为共享区
 */
/*public class StaticVarDemo {
    public static int count=100;

    public StaticVarDemo(){}

    public static void main(String[] args) {
        StaticVarDemo demo1=new StaticVarDemo();
        StaticVarDemo demo2=new StaticVarDemo();

        //demo1.count++;
        int x=demo2.count++;
        //int x=StaticVarDemo.count++;
        System.out.println("count"+x+"静态:"+StaticVarDemo.count);

    }
}*/
/*
public class StaticVarDemo {
    long width;
    public StaticVarDemo(long l) {
        width = l;
    }
    public static void main(String arg[]) {
        */
/*StaticVarDemo a, b, c;
        a = new StaticVarDemo(42L);
        b = new StaticVarDemo(42L);
        c = b;
        long s = 42L;

        System.out.println(a.equals(b));
        System.out.println(b==c);
        System.out.println(a.equals(s));*//*

        Integer i01 = 59;
        int i02 = 59;
        Integer i03 =Integer.valueOf(59);
        Integer i04 = new Integer(59);
        System.out.println(i01==i02); //true
        System.out.println(i01==i03); //true
        System.out.println(i03==i04); //false
        System.out.println(i02==i04); //true
    }
}*/
public class StaticVarDemo {
    private static int x = 100;
    static {
        System.out.println("StaticVarDemo"+x);
    }

    public static void main(String args[]) {
        int i=0;
        int j=0;
        i=i++;
        j=i++;
        System.out.println(i);
        System.out.println(j);
        /*i=i++;
        System.out.println(i);*/
        /*double i1=30;
        double i2=20;
        double i = i1/i2;
        System.out.println(i);

        StringBuilder sb=new StringBuilder();*/

        StaticVarDemo hs1 = new StaticVarDemo();
        //hs1.x++;
        StaticVarDemo hs2 = new StaticVarDemo();
        //hs2.x++;
        hs1 = new StaticVarDemo();
        //hs1.x++;
        StaticVarDemo.x--;
        System.out.println("x=" + x);
        System.out.println(hs1.x==hs2.x);
    }
}
